<?php
namespace App\Http\Controllers\Login;
use App\Http\Controllers\ApiBaseController;
use Illuminate\Http\Request;
use App\Models\AdminModels\Message;
class MessageAjaxController extends ApiBaseController{
  public function __construct(Request $request) {
    parent::__construct($request);
  }

  public function dataList(Request $request){
    $oMessage = new Message();
    $result = $oMessage->getPageData($this->params);
    echo json_encode($result);
  }
    /*
    * 消息详情 目前还是跳页面的吧
    * */
    public function messageInfo(){
        $re=$this->params;
        // print_r($re);exit();
        $oMessage = new Message;
        $res = $oMessage->messageInfo($this->params['kid']);
        if($res){
            $this->returnJson(0,$res);
        }
        $this->returnJson(1,"数据错误");
    }
  /**
    * 操作状态
    * 开启/关闭
    */
  public function deleteData(){
    if(isset($this->params['id']) && intval($this->params['id']) > 0 && isset($this->params['status'])){
      $oMessage = new Message();
      if($oMessage->db_update('',$this->params['id'],['status'=>$this->params['status']])){
        $this->data = true;
      }else{
        $this->code = 1;
        $this->msg = '操作失败';
      }
    }else{
      $this->code = 1;
      $this->msg = '缺少数据';
    }
    $this->boot();
  }
}